class_name GameplayEffectAsset
extends Resource

## 堆叠策略
enum StackPolicy {
	None,
	AggregateBySource,
	AggregateByTarget,
}


@export_group("资源信息")

## 效果名称
@export var name: String

## 效果描述
@export_multiline var description: String

## 效果资源标签
@export var asset_tags: Array[String]

## 效果组件
@export var component_assets: Array[GameplayEffectComponentAsset]


@export_group("效果")

## 所需要修改的属性名称
@export var attribute_name: String

## 用于修改属性的修改器
@export var modifier_asset: GameplayEffectModifierAsset


@export_group("施加策略")

## 堆叠策略
@export var stack_policy: StackPolicy

## 效果激活时所不能拥有的标签，否则效果则不能激活
@export var tags_cancelled_effect: Array[String]


func has_component(type_name: String) -> bool:
	for component_asset: GameplayEffectComponentAsset in component_assets:
		if component_asset.get_component_name() == type_name:
			return true
	return false


func create_spec(target: Variant) -> GameplayEffect:
	return GameplayEffect.new(self, target)
